package fr.utbm.lo54.domain;

import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooJpaActiveRecord
public class Client {

    @NotNull
    @Size(min = 2, max = 25)
    private String lastName;

    @NotNull
    @Size(min = 2, max = 25)
    private String firstName;

    @NotNull
    @Size(min = 2, max = 100)
    private String address;

    @NotNull
    @Pattern(regexp="^[0-9]+$",message="Invalid phone number")
    @Size(min = 2, max = 20)
    private String phone;

    @NotNull
    @Pattern(regexp="^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}$",message="Invalid email")
    @Size(min = 2, max = 50)
    private String email;

    @ManyToOne
    private Session session;
}
